package io.renren.modules.app.utils;

import java.io.File;

import javax.imageio.stream.FileImageOutputStream;

public class ImageUtils {

	// byte数组到图片到硬盘上
	public static void byte2image(byte[] data, String path) {
		if (data.length < 3 || path.equals(""))
			return;// 判断输入的byte是否为空
		try {
			FileImageOutputStream imageOutput = new FileImageOutputStream(new File(path));// 打开输入流
			imageOutput.write(data, 0, data.length);// 将byte写入硬盘
			imageOutput.close();
			System.out.println("Make Picture success,Please find image in " + path);
		} catch (Exception ex) {
			System.out.println("Exception: " + ex);
			ex.printStackTrace();
		}
	}

}
